import React, { Component } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as personAction from './store/action/person.action'

class App extends Component {

  handleClick = async () => {
    this.props.getPerson([{ id: 1, name: 'syy' }])
  }

  render() {
    console.log(this.props)
    return (
      <div className="App">
        <button onClick={this.handleClick}>获取数据</button>
      </div>
    );
  }
}
 
const mapStateToProps = (state) => {
  console.log(state, 'state')
  return {
    person: state.person
  }
}

const mapActionToProps = (dispatch) => {
  return {
    ...bindActionCreators(personAction, dispatch)
  }
}

export default connect(mapStateToProps, mapActionToProps)(App);
